using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using Mango.Framework.Common;

namespace Mango {
    public partial class ProjectProperties : Form {
        private Project m_Project = null;

        public ProjectProperties (Project project) {
            m_Project = project;
            InitializeComponent ();
        }

        protected override void OnLoad(EventArgs e) {
            base.OnLoad (e);

            m_GuiMoveUp.ImageList = m_GuiMoveDown.ImageList =
                m_GuiDelete.ImageList = m_GuiResLocView.SmallImageList = 
                    Singleton.Ref<ImageManager> ().ImageList;

            m_GuiMoveUp.ImageIndex = Singleton.Ref<ImageManager> ().GetImageIndex ("misc.uparrow");
            m_GuiMoveDown.ImageIndex = Singleton.Ref<ImageManager> ().GetImageIndex ("misc.downarrow");
            m_GuiDelete.ImageIndex = Singleton.Ref<ImageManager> ().GetImageIndex ("misc.delete");
        }

        private void m_GuiAddDirectory_Click (object sender, EventArgs e) {
            DialogResult dr = m_GuiFolderBrowser.ShowDialog (this);
            if(dr == DialogResult.OK) {
                m_GuiResLocView.Items.Add (
                    m_GuiFolderBrowser.SelectedPath,
                    Singleton.Ref<ImageManager> ().GetImageIndex ("project.directory")
                );
            }
        }

        private void m_GuiAddArchive_Click (object sender, EventArgs e) {
            DialogResult dr = m_GuiOpenFile.ShowDialog (this);
            if(dr == DialogResult.OK) {
                foreach(string file in m_GuiOpenFile.FileNames) {
                    m_GuiResLocView.Items.Add (
                        file,
                        Singleton.Ref<ImageManager> ().GetImageIndex ("project.archive")
                    );
                }
            }
        }

        private void m_GuiMoveUp_Click (object sender, EventArgs e) {
            if(m_GuiResLocView.SelectedIndices.Count > 0) {
                int idx = m_GuiResLocView.SelectedIndices[0];
                if(idx < 1) {
                    return;
                }
            }
        }
    }
}
